'''Level 4'''
import urllib.request,re
p = re.compile(r'the next nothing is ([0-9]+)')
nothing = '72758'
url = 'http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing='+nothing
while True:
    response = urllib.request.urlopen(url)
    html = response.read().decode('utf-8')
    nothing = p.search(html).group(1)
    print(nothing)
    if nothing==None:
        print('you need to check manually')
        break
    url = 'http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing='+nothing


